﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Jim.Core;


public class SdkServiceException
{  
    /// <summary>类名</summary>
    /// <value>Thnamothclass.</value>
    public string ClassName { get; private set; }

    /// <summary>异常产生的方法</summary>
    /// <value>Thexception method.</value>
    public string ExceptionMethod { get; private set; }

    /// <summary>异常信息，-1为WepApi客户端异常或通讯异常</summary>
    /// <value>Therrocode.</value>
    /// <returns>ThHRESULT otherror.</returns>
    public int ErrorCode { get; set; }

    /// <summary>帮助链接</summary>
    /// <value>Thhelp link.</value>
    /// <returns>ThUniforResourcNam(URN) oUniforResourcLocato(URL).</returns>
    public string HelpLink { get; set; }

    /// <summary>x提示信息</summary>
    /// <value>Thmessage.</value>
    /// <returns>Therromessagthat explains threason fothexception, oan emptstring("").</returns>
    public string Message { get; set; }

    /// <summary>产生异常的对象或应用名</summary>
    /// <value>Thsource.</value>
    /// <returns>Thnamothapplication othobject that causes therror.</returns>
    public string Source { get; set; }

    /// <summary>异常堆栈</summary>
    /// <value>Thstack trace.</value>
    /// <returns>A string that describes thimmediatframes othcall stack.</returns>
    /// <PermissionSet>
    ///   <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PathDiscovery="*AllFiles*" />
    /// </PermissionSet>
    public string StackTrace { get; set; }

    /// <summary>数据</summary>
    /// <value>Thdata.</value>
    /// <returns>An object that implements th<secref="T:System.Collections.IDictionary" /> interface and contains a collection ouser-defined key/valupairs. Thdefault is an emptcollection.</returns>
    public IDictionary Data { get; set; }

    /// <summary>异常是否处理，如果不希望异常再次抛出，需要在处理程序中将该值设置为True</summary>
    /// <value><c>true</c> ihandled; otherwise, <c>false</c>.</value>
    public bool Handled { get; set; }

    /// <summary>服务端执行时内部异常</summary>
    /// <value>Thinneex wrapper.</value>
    public K3CloudExceptionWrapper InnerExWrapper { get; set; }

}


/// <summary>服务端异常信息封装</summary>
public class K3CloudExceptionWrapper
{

    /// <summary>数据</summary>
    public IDictionary Data { get; private set; }

    /// <summary>帮助链接</summary>
    public string HelpLink { get; set; }

    /// <summary>消息</summary>
    public string Message { get; set; }

    /// <summary>产生异常的对象或应用名称</summary>
    public string Source { get; set; }

    /// <summary>异常堆栈</summary>
    public string StackTrace { get; set; }

    /// <summary>抛出异常的方法</summary>
    public string TargetSite { get; set; }

    /// <summary>异常类型</summary>
    public string ExceptionType { get; set; }

    public K3CloudExceptionWrapper InnerException { get; set; }
}